import java.awt.Color;
import java.awt.Font;
import java.lang.*;
import java.math.*;
import java.util.Random;

import no.geosoft.cc.geometry.Box;
import no.geosoft.cc.geometry.Geometry;
import no.geosoft.cc.graphics.*;

public class HelloWorld extends GObject {
	    private GSegment star_;
	    private GText text;
	    private Random rand = new Random();
	    
	    public HelloWorld()
	    {
	      star_ = new GSegment();
	      GStyle starStyle = new GStyle();
	      starStyle.setForegroundColor (null);
	      starStyle.setBackgroundColor (null);
	      starStyle.setLineWidth (0);
	      setStyle (starStyle);
	      addSegment (star_);
	      
	      text = new GText ("@", 12);
	      GStyle textStyle = new GStyle();
	      textStyle.setForegroundColor (new Color (255, 150, 50));
	      textStyle.setBackgroundColor (null);
	      textStyle.setFont (new Font ("Dialog", Font.BOLD, 12));
	      text.setStyle (textStyle);
	      text.setText (text.getText());
	      star_.setText(text);
	    }
	    

	  
	    /**
	     * This method is called whenever the canvas needs to redraw this
	     * object. For efficiency, prepare as much of the graphic object
	     * up front (such as sub object, segment and style setup) and
	     * set geometry only in this method.
	     */
	    public void draw()
	    {
	    	int x=rand.nextInt(249)+1;
	    	int y=rand.nextInt(249)+1;
	    	int xl=rand.nextInt(249)+1;
	    	int yl=rand.nextInt(249)+1;
	    	star_.setGeometry (Geometry.createRectangle(x, y, 0, 0)); // (x, y, inner radius, point radius, number of points)
	    }
}
